ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Modbus functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Reads one or more single-precision floats from a Modbus slave, starting at a specific address.
New in version 2024
WEBDEV - Server codeWindows This function is now available for WEBDEV websites in Windows.
WEBDEV - Server codeLinux This function is now available for WEBDEV websites in Linux.
Example
// Crée une session et connexion Ã  un serveur Modbus
Session is modbusSession
Session = ModbusConnectTCP("192.168.1.7")

tabRéponse is array of 5 4-byte real

// Si la connexion Ã©choue, affiche l'erreur
IF ErrorOccurred = True THEN
Trace(ErrorInfo())
ELSE
// Lit une séquence de 5 flottants en mode ABCD
// en lecture-écriture Ã  partir de l'adresse 0x42.
tabRéponse = Session.LitFlottant(0x42, 5, False, modbusABCD)
// Si il y a eu une erreur on l'affiche.
IF ErrorOccurred = True THEN
Trace(ErrorInfo())
END
END

// Déconnexion
Session.Déconnecte()
Syntax

Reading 1 single-precision float from a Modbus slave Hide the details

<Result> = <Session>.ReadFloat(<Address> , <Read-only> , <Endianness>)
<Result>: Real
Float value read.
<Session>: modbusSession variable
Name of the modbusSession variable that corresponds to the communication session with the Modbus slave.
<Address>: Integer
Address of the float in the slave (between 0 and 65,535).
<Read-only>: Boolean
  • True if the floats to be read are part of read-only data (Modbus function code 4 (Read Input Registers)).
  • False if the floats to be read are part of read-write data (Modbus function code 3 (Read Multiple Holding Registers)).
<Endianness>: Integer constant
Mode for storing float values on the slave device. Bytes are identified from A to D. A is the most significant byte and D is the least significant byte (IEEE-754 standard).
modbusABCDThe sent bytes are stored the same order on the slave device.
modbusBADCThe sent bytes are swapped 2 by 2 on the slave device.
modbusCDABThe sent bytes are swapped 2 by 2 on the slave device.
modbusDCBAThe sent bytes are swapped on the slave device.

Reading multiple single-precision floats from a Modbus slave Hide the details

<Result> = <Session>.ReadFloat(<Address> , <Number of floats> , <Read-only> , <Endianness>)
<Result>: Array
Array of reals that contains the value of the floats read.
<Session>: modbusSession variable
Name of the modbusSession variable that corresponds to the communication session with the Modbus slave.
<Address>: Integer
Starting address of the floats in the slave (between 0 and 65,535).
<Number of floats>: Integer
Number of floats to be read (to be sent by the slave).
<Read-only>: Boolean
  • True if the floats to be read are part of read-only data (Modbus function code 4 (Read Input Registers)).
  • False if the floats to be read are part of read-write data (Modbus function code 3 (Read Multiple Holding Registers)).
<Endianness>: Integer constant
Mode for storing float values on the slave device. Bytes are identified from A to D. A is the most significant byte and D is the least significant byte (IEEE-754 standard).
modbusABCDThe sent bytes are stored the same order on the slave device.
modbusBADCThe sent bytes are swapped 2 by 2 on the slave device.
modbusCDABThe sent bytes are swapped 2 by 2 on the slave device.
modbusDCBAThe sent bytes are swapped on the slave device.
Remarks
  • This function blocks the application until the slave responds to the message or until the session timeout is exceeded.
  • After calling <modbusSession>.ReadFloat, it is recommended to check the ErrorOccurred variable to make sure there are no errors.
Business / UI classification: Business Logic
Component: wd290com.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/17/2023

Send a report | Local help